package com.bc.commoncore.config;

import com.bc.commoncore.security.AES;
import com.bc.commoncore.util.ParseHelper;
import com.bc.commoncore.util.PropertyUtils;

public class ConfigBase {
	// 是否发送错误邮件
	private static String isSendMail;
	// 邮件地址
	private static String emailHost;
	// 错误邮件来源
	private static String emailFrom;

	// 错误邮件发送到
	private static String emailTo;
	// 邮件发送人
	private static String emailUserName;
	// 发件人密码
	private static String emailPwd;

	private static int defaultPageSize;
	// 是否开启mongo记录日志
	private static String isOpenMongoLog;
	// 是否开启es记录日志
	private static String isOpenESLog;
	// ES日志记录IP:端口
	private static String eSClientData;

	public static String getIsSendMail() {
		return PropertyUtils.getProperty("isSendMail");
	}
	public static String getEmailHost() {
		return PropertyUtils.getProperty("emailHost", "");
	}
	public static String getEmailFrom() {
		return PropertyUtils.getProperty("emailFrom");
	}
	public static String getEmailTo() {
		return PropertyUtils.getProperty("emailTo");
	}

	public static String getEmailUserName() {
		return PropertyUtils.getProperty("emailUserName");
	}

	public static void setEmailUserName(String emailUserName) {
		ConfigBase.setEmailUserName(emailUserName);
	}

	public static String getEmailPwd() {
		String emailPwd= PropertyUtils.getProperty("emailPwd");
		if (emailPwd != null && !emailPwd.isEmpty()) {
			return AES.aesDecrypt(emailPwd);
		}
		return emailPwd;
	}
	public static String getIsOpenMongoLog() {
		return PropertyUtils.getProperty("isOpenMongoLog");
	}
	public static String getIsOpenESLog() {
		return PropertyUtils.getProperty("isOpenESLog");
	}
	public static int getDefaultPageSize() {
		int defaultPageSize= ParseHelper.ToInt(PropertyUtils.getProperty("defaultPageSize"),20);
		if (defaultPageSize <= 0) {
			return 20;
		}
		return defaultPageSize;
	}


}
